const express = require('express');
const path = require('path');
const request = require('request');
// 配置静态文件服务中间件
// server地址
const app = express();
const port = 4004;
let serverUrl = 'http://localhost:4002';

app.get('/', (req, res) => res.send('Hello World!'));

app.use('/a', function (req, res) {
    // console.log(req.url);
    let url = serverUrl + '/a';
    // let url = 'https://www.baidu.com';
    // let url = 'https://www.7-zip.org/a/7z1900.exe';
    req.pipe(request(url)).pipe(res);
});


app.listen(port, function () {
  console.info(`server started in http://localhost:${port}`);
});
